import com.formdev.flatlaf.FlatDarkLaf;
import com.plealog.genericapp.api.EZApplicationBranding;
import com.plealog.genericapp.api.EZEnvironment;
import com.plealog.genericapp.api.EZGenericApplication;
import com.plealog.genericapp.api.log.EZLogger;
import session.BaseSession;

import java.awt.*;
import java.util.ResourceBundle;

public class Start {
	public static void main(String[] args) {
		EventQueue.invokeLater(() -> {
			FlatDarkLaf.setup();
			EZGenericApplication.initialize("只狼mod开发工具");
			// 应用基本信息
			EZApplicationBranding.setAppName("只狼mod开发工具");
			EZApplicationBranding.setAppVersion("1.0.3");
			EZApplicationBranding.setCopyRight("Created by me");
			EZApplicationBranding.setProviderName("苇名弦一郎");

			EZEnvironment.addResourceLocator(Start.class);

			// 顶部菜单
			ResourceBundle rb = ResourceBundle.getBundle("menu");
			EZEnvironment.setUserDefinedActionsResourceBundle(rb);
			rb = ResourceBundle.getBundle("messages");
			EZEnvironment.setUserDefinedMessagesResourceBundle(rb);

			// 读取session数据，需要在调用Listener之前调用
			BaseSession.initSessionData();

			// 监听菜单
			EZEnvironment.getActionsManager().addActionMenuListener(new MyActionManager());

			// 监听应用启动生命周期
			EZEnvironment.setUIStarterListener(new ApplicationStarterListener());

			// 启动应用
			EZGenericApplication.startApplication(args);
			EZLogger.info("应用启动");
		});
	}
}